const state = {
  roomId: 0,
  whiteBoardStatus: false,
  roomLoading: false, // loading加载状态
  netlessToken: '', // 白板token
  netlessAppid: '', // 白板appid
  netlessOssInfo: {}, // oss配置信息
  liveCourseDialogVisible: false
}

const mutations = {
  ['ROOM_LOADING_STATUS'](state, value) {
    state.roomLoading = value
  },
  ['WHITE_BOARD_STATUS'](state, value) {
    state.whiteBoardStatus = value
  },
  ['NETLESS_TOKEN'](state, value) {
    state.netlessToken = value
  },
  ['NETLESS_APPID'](state, value) {
    state.netlessAppid = value
  },
  ['NETLESS_OSS'](state, data) {
    state.netlessOssInfo = data
  },
  ['CourseDialogVisible'](state, val) {
    state.liveCourseDialogVisible = val
  },
  ['roomId'](state, val) {
    state.roomId = val
  }
}

const actions = {
  // 房间加载遮罩层
  setLoading({ commit }, value) {
    commit('ROOM_LOADING_STATUS', value)
  },
  // 设置白板显示状态
  setWhiteBoardStatus({ commit }, value) {
    commit('WHITE_BOARD_STATUS', value)
  },
  // 直播白板token
  setNetlessToken({ commit }, value) {
    commit('NETLESS_TOKEN', value)
  },
  // 白板的appid
  setNetlessAppid({ commit }, value) {
    commit('NETLESS_APPID', value)
  },
  // 直播阿里云oss配置信息
  setNetlessOssInfo({ commit }, data) {
    commit('NETLESS_OSS', data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
